DIRHEAD := /home/xcy/workspace/trunk/Server/src

#源文件绝对路径
SOURCE	:= $(wildcard *.c) $(wildcard *.cpp)
SOURCE	+= $(wildcard $(DIRHEAD)/proto/*.cc)
#SOURCE	+= $(wildcard $(DIRHEAD)/proto/*.cc) $(wildcard $(DIRHEAD)/proto/*.cpp)

PROTO	+= $(wildcard $(DIRHEAD)/proto/*.cc)

#BASENAME:= $(notdir $(SOURCE))
OBJS    := $(patsubst %.c,%.o,$(patsubst %.cc,%.o,$(patsubst %.cpp,%.o,$(SOURCE))))
  
#target you can change test to what you want
#目标文件名，输入任意你想要的执行文件名
TARGET  := main
  
#compile and lib parameter
#编译参数
CC      := g++

LIBS    := -L$(DIRHEAD)/deps/gdk/lib
LIBS	+= -L$(DIRHEAD)/deps/libuv/lib
LIBS	+= -L$(DIRHEAD)/deps/protobuf/lib

INCLUDE := -I$(DIRHEAD)/deps/gdk/include -I$(DIRHEAD)/libsk
INCLUDE += -I$(DIRHEAD)/proto
INCLUDE += -I$(DIRHEAD)/deps/protobuf/include
INCLUDE += -I$(DIRHEAD)/deps/libuv/include

LDFLAGS := -lprotobuf -luv -lgdk_ConsoleLog -lgdk_SimpleNetwork -lgdk_net -lgdk_core -llzo2 -lssl -lcrypto -lpthread -g -Wall
DEFINES := -std=c++14

CFLAGS  := -g -Wall -O3 $(DEFINES) $(INCLUDE)
CXXFLAGS:= $(CFLAGS) -DHAVE_CONFIG_H
  
  
#i think you should not do anything next
#下面的基本上不需要做任何改动了
.PHONY : everything objs clean veryclean rebuild
  
everything : $(TARGET)
  
all : $(TARGET)
  
objs : $(OBJS)
  
rebuild: veryclean everything

clean :
	rm $(OBJS)
	rm -rf *.so
	rm -fr *.o
    
veryclean : clean
	rm -fr $(TARGET)
  
#	$(CC) $(CXXFLAGS) -o $@ $(OBJS) $(PROTO) $(LDFLAGS) $(LIBS)
$(TARGET) : $(OBJS)
	$(CC) $(CXXFLAGS) -o $@ $(OBJS) $(LDFLAGS) $(LIBS)
